﻿using System;
using System.IO;
using Hongsh.Pay.Client.Proxy.Http;
using MapleLeaf.Pay;

namespace Hongsh.Pay.Client.Proxy.Handlers {
    // Token: 0x02000042 RID: 66
    public static class BWInsPayProxy {
        // Token: 0x06000201 RID: 513 RVA: 0x00003584 File Offset: 0x00001784
        public static void AddBWInsPayProxyHandler(this HttpServer svr) {
            svr.RouterList.Add("POST/BWInsPaySrv.ashx", new HttpContextActionDelegate(Proc));
        }

        // Token: 0x06000202 RID: 514 RVA: 0x0000D34C File Offset: 0x0000B54C
        private static void Proc(HttpContext ctx) {
            string text = new StreamReader(ctx.Request).ReadToEnd();
            string json = System.Web.HttpUtility.UrlDecode(text.Substring(BWPayInitParamHeader.Length));
            BWInsPayRequest bwinsPayRequest = json.JsonDecode<BWInsPayRequest>();
            string sAction = bwinsPayRequest.sAction;
            string a = sAction;
            if (!(a == "gettokennew")) {
                ctx.Result = HttpResult.NoFound;
            }
            else {
                ctx.Result = new HttpJsonResult(new BWInsPayResult {
                    code = "ZKKCbFQ/WwAFh6GfLkOqJYbBVcxZUC9G7GA0dIp9xT4hgLfKXnLa+sxISfcIXTZ83T1FcAe/Eqa18BFhPk5zat5riCUd9pJ0xoJegQg89WmBEYfxS/fYYsG9RLCy9nV7CEluf8E2l7UHDBT4POdSqDNLnChdil2lNGZFw1Ir4ulXTyxMC7eNA1wnQnXXphWfdeZ0tGE1aRTMUIpRGa2Dr+HK46QKNqrvdTMpoOXFE196DPIKFD0d4db+4soI2k09l1utRKRE5lvYjmz5IOqALzYyyiZfo9WYw2cLOY6/8tSnaJGYkvc11xEV+Hth3SzN0kk7qBNGRg4eN0B5gxseD/J9rM6Ja0IiuuqDiFcW7ENj6UKKieXI2Qascsadcl4MnTnWAKml86QGfeGrbiZKA1fFDnh5u9S13uey8RscZLFPPQFpPDEAt2wk7AhwXLEGjsDXObRSBcSY3qBh+ltLwh5TO8U44zGe9Pwtx+/PDfY1U0u7SqoWHXfiGnIsQgSr+n2ohb+Xl0o1jApO8wLivF8qsP5LXu7pM81y0wEUbFkgL/0yNoCT6qDskp5wxOqjFVpbaTl4FErPaYZn2pnh8Ob2eq53G33e28F0q8rRlcnFsk6wdnUH23BnF4X8+VDyk3id7AwzuZP+T/CMxsWd/nJS/gT+Qt4psohTUMHCqcBMnGi65fMvqgLKGc8k+9WABYy+hnYFUtwJ8lHImXcQ+IuCJaDCZdEM/bpOkFp9O9p9QFgGn4Tr8nZP41NblScovSbThLNGNC9bNosnDesa2+syk5uVJra5IAKlMkvXwcEuNbgWkl+qyB9QNUg5B/e7h4fwj3I8tCMbbA05cv9TFQwmt60WZyoGKW3Pf45jGW3dnz91RnfEV7zHYggTztYn",
                    bResult = true
                });
            }
        }

        // Token: 0x06000203 RID: 515 RVA: 0x000035A2 File Offset: 0x000017A2
        static BWInsPayProxy() {
            //Class15.cwcZ3SWztHroi();
            BWPayInitParamHeader = "sParam=";
        }

        // Token: 0x040000D8 RID: 216
        private static string BWPayInitParamHeader;

        // Token: 0x02000043 RID: 67
        private class BWInsPayRequest {
            // Token: 0x170000DC RID: 220
            // (get) Token: 0x06000204 RID: 516 RVA: 0x000035B3 File Offset: 0x000017B3
            // (set) Token: 0x06000205 RID: 517 RVA: 0x000035BB File Offset: 0x000017BB
            public string sAction { get; set; }

            // Token: 0x170000DD RID: 221
            // (get) Token: 0x06000206 RID: 518 RVA: 0x000035C4 File Offset: 0x000017C4
            // (set) Token: 0x06000207 RID: 519 RVA: 0x000035CC File Offset: 0x000017CC
            public string sCode { get; set; }

            // Token: 0x170000DE RID: 222
            // (get) Token: 0x06000208 RID: 520 RVA: 0x000035D5 File Offset: 0x000017D5
            // (set) Token: 0x06000209 RID: 521 RVA: 0x000035DD File Offset: 0x000017DD
            public string sMd5 { get; set; }

            // Token: 0x0600020A RID: 522 RVA: 0x0000286D File Offset: 0x00000A6D
            public BWInsPayRequest() {
                //Class15.cwcZ3SWztHroi();
                //base..ctor();
            }
        }

        // Token: 0x02000044 RID: 68
        private class BWInsPayResult {
            // Token: 0x170000DF RID: 223
            // (get) Token: 0x0600020B RID: 523 RVA: 0x000035E6 File Offset: 0x000017E6
            // (set) Token: 0x0600020C RID: 524 RVA: 0x000035EE File Offset: 0x000017EE
            public string code { get; set; }

            // Token: 0x170000E0 RID: 224
            // (get) Token: 0x0600020D RID: 525 RVA: 0x000035F7 File Offset: 0x000017F7
            // (set) Token: 0x0600020E RID: 526 RVA: 0x000035FF File Offset: 0x000017FF
            public bool bResult { get; set; }

            // Token: 0x170000E1 RID: 225
            // (get) Token: 0x0600020F RID: 527 RVA: 0x00003608 File Offset: 0x00001808
            // (set) Token: 0x06000210 RID: 528 RVA: 0x00003610 File Offset: 0x00001810
            public string errMsg { get; set; }

            // Token: 0x06000211 RID: 529 RVA: 0x0000286D File Offset: 0x00000A6D
            public BWInsPayResult() {
                //Class15.cwcZ3SWztHroi();
                //base..ctor();
            }
        }
    }
}
